
%!TEX program = xelatex
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[10pt]{article} 

\input{wang_preamble.tex}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titling}
\setlength{\droptitle}{-2cm}   % This is your set screw

%%文档的题目、作者与日期
\author{Class 2019 Math and Applied Math }
\title{Applied Stochastic Processes - Quiz 02 - Solution}
%\date{\vspace{-3ex}}
%\renewcommand{\today}{\number\year \,年 \number\month \,月 \number\day \,日}
%\date{2021 年 2 月 28 日}
\date{April 27, 2021}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\maketitle

\begin{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item
Components in a machine fail and are replaced according to a Poisson process of rate 3 components a month.
\begin{enumerate}
\item   Find the probability that exactly 3 components fail in the first month and exactly 5 components fail in the next two months.
\item   Find the probability that exactly 3 components fail in the first month given that exactly 8 components fail in the first three months.
\end{enumerate}

{\it \color{red} \underline{Solution.}

\begin{enumerate}

\item
Let $X(t)$ be the number of components replaced during $(0,t]$ months. Then $\{X(t),t\ge 0\}$ is a Poisson process with rate $\lambda = 3$ components/month.
\begin{eqnarray*}
&& P[X(1)=3,X(3)-X(1)=5] \\
&=& P[X(1)=3]\cdot P[X(3)-X(1)=5] \\
&=&  \frac{\lambda^3}{3!}e^{-\lambda}\cdot  \frac{(2\lambda)^5}{5!}e^{-2\lambda}.
\end{eqnarray*}

\item The first method is to use the definition of conditional probability. 
\begin{eqnarray*}
&& P[X(1)=3 \mid X(3)=8] = \frac{P(X(1)=3,X(3)=8)}{P[X(3)=8]} \\
&=& \frac{P(X(1)=3,X(3)-X(1)=5)}{P[X(3)=8]}=\frac{\frac{\lambda^3}{3!}e^{-\lambda}\cdot  \frac{(2\lambda)^5}{5!}e^{-2\lambda}}{\frac{(3\lambda)^8}{8!}e^{-3\lambda}}
=\frac{8!}{3!5!}\cdot\frac{2^5}{3^8}.
\end{eqnarray*}

The second method is to use the uniform distribution of occurrence times conditioned on a fixed number of events in an interval. Now we are given the condition that there ere exactly 8 fails in the first three months. Thus these occurrence times (before taking the order) are uniformly distributed in this interval, and the probability that there are exactly 3 fails in the first month is
\begin{eqnarray*}
P[X(1)=3,X(3)-X(1)=5]  = C_8^3\left(\frac{1}{3}\right)^3\left(\frac{2}{3}\right)^5.
\end{eqnarray*}

\end{enumerate}

}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item
The first Line 9 train leaves the GT Station at 6am. People arrive at the GT Station according to a Poisson process of rate 2 people per minute, starting from 5:30. 
\begin{enumerate}
\item   Determine the mean total number of the people taking the first train at this station.
\item   Determine the mean total waiting time of the people taking the first train.
\end{enumerate}

{\it \color{red} \underline{Solution.}
\begin{enumerate}
\item   
Let $X(t)$ be the number of passengers arriving at the GT Station during time interval $(5:30,5:(30+t)]$ where $t$ is measured in minutes. 
Then $\{X(t),t\ge 0\}$ is a Poisson process with rate $\lambda = 2$ people per minute. 
Then $X(30)$ is Poisson random variable with parameter $60$. Thus $E[X(30)]=60$. 


\item   
Let $5:(30+W_k)$ be the arrival time of the $k$th passenger, $k=1,2,\cdots$. 
During [5:30, 6:00] there are $X(30)$ passengers, and their total waiting time is 
\begin{eqnarray*}
(30-W_1)+(30-W_2)+\cdots+(30-W_{N(30)}). 
\end{eqnarray*}
Then we use the uniform distribution of occurrence times conditioned on a fixed number of events in an interval. 
The mean waiting time of each passenger is 15 minutes, and the mean total waiting time is
\begin{eqnarray*}
\sum\limits_{k=0}^{\infty} P[X(30)=k]\cdot (15k) = \sum\limits_{k=0}^{\infty} \frac{(60)^k}{k!}e^{-60}\cdot (15k) = 900. 
\end{eqnarray*}
\end{enumerate}

}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item
Let $X$ and $Y$ be two independent exponential random variables with parameters $\mu>0$ and $\lambda>0$ respectively.
Calculate $P(\min(X,Y)>r)$ for $r\ge 0$. Hence show that $\min(X,Y)$ also has an exponential distribution, whose parameter you should determine.

{\it \color{red} \underline{Solution.}
We compute the tail probability,
\begin{eqnarray*}
P[\min(X,Y)>r] = P(X>r,Y>r) = P(X>r)P(Y>r)=e^{-\mu r} e^{-\lambda r} = e^{-(\mu+\lambda)r}.
\end{eqnarray*}
Thus $\min(X,Y)$ is a random variable of exponential distribution, with parameter $\mu+\lambda$.

}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item
Suppose that $\{X(t),t\ge 0\}$ is a Poisson process with rate $\lambda>0$, and the arrival times are $W_1, W_2,\cdots$.
Evaluate the following probabilities in terms of $\lambda$.
\begin{enumerate}
\item   $P[X(3) = 5]$.
\item   $P[X(3)-X(1) = 4]$.
\item   $P[X(1)\ge 1 \text{ and } X(3)\le 2]$.
\item   $P(W_1>1/2)$.
\item   $P(W_1>1/2 \textrm{ and } W_3\le 3/2)$.
\item   $P(W_1>1 \textrm{ and } W_2-W_1\le 1/2)$.
\end{enumerate}

{\it \color{red} \underline{Solution.}

\begin{enumerate}
\item
$X(3)$ is a random variable of Poisson distribution with parameter $3\lambda$. Thus we have 
\begin{eqnarray*}
P[X(3) = 5]=\frac{(3\lambda)^5}{5!}e^{-3\lambda}.
\end{eqnarray*}

\item
$X(3)-X(1)$ is a random variable of Poisson distribution with parameter $2\lambda$, thus
\begin{eqnarray*}
P[X(3)-X(1) = 4]=\frac{(2\lambda)^4}{4!}e^{-2\lambda}.
\end{eqnarray*}

\item
There are three different cases, 
\begin{eqnarray*}
&& P[ X(1)\ge 1 \textrm{ and } X(3)\le 2 ] \\
&=& P[X(1)= 1, X(3) = 1] + P[X(1)= 1, X(3) = 2] + P[X(1)= 2, X(3) = 2]=
\end{eqnarray*}

\item 
The arrival time $W_1$ is a random variable of exponential distribution, and its mean is $1/\lambda$. Thus we have 
\begin{eqnarray*}
P[W_1>1/2] = e^{-\lambda/2}.
\end{eqnarray*}
A second method is to compute in terms of $X(t)$, 
\begin{eqnarray*}
P[W_1>1/2] = P[X(0.5)=0] = e^{-0.5\lambda}.
\end{eqnarray*}

\item
We rewrite the problem in terms of the counting process $X(t)$, 
\begin{eqnarray*}
&& P[W_1>1/2, W_3\le 3/2] \\
&=& P[X(0.5)=0, X(1.5)\ge 3)] \\
&=& P[X(0.5)=0, X(1.5)-X(0.5)\ge 3)] =
\end{eqnarray*}

\item
We rewrite the problem in terms of sojourn times $S_k$, 
\begin{eqnarray*}
&& P(W_1>1, W_2-W_1\le 1/2) \\
&=& P(S_1>1, S_2\le 0.5) \\
&=& P(S_1>1) \cdot P(S_2\le 0.5) \\
&=& e^{-\lambda}\cdot (1-e^{-0.5\lambda}).
\end{eqnarray*}

\end{enumerate}

}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item
Cars pass a certain street location according to a Poisson process with rate $\lambda=3$ cars per minute. A woman who wants to cross the street at that location waits until she can see that no cars will come by in the next minute.
\begin{enumerate}
\item Find the probability that her waiting time is 0.
\item Find her expected waiting time. Hint: Condition on the time of the first car.
\end{enumerate}


{\it \color{red} \underline{Solution.}
(a) Let $S_1,S_2,S_3,\cdots$ be the inter-arrival times of the cars. 
Then each $S_k$ is exponentially distributed with mean $1/\lambda$, and they are independent. 
The woman does not have to wait if and only if $S_1 \ge 1$. The probability is 
\begin{eqnarray*}
P(S_1 \ge 1)=e^{-\lambda}.
\end{eqnarray*}

(b) Let $\xi$ be the waiting time. It is a random variable. It can be expresses as
\begin{eqnarray*}
\xi=\left\{\begin{array}{ll}
0, &\text{ if } S_1\ge 1, \\
S_1, &\text{ if } S_1<1, S_2\ge 1, \\
S_1+S_2, &\text{ if } S_1<1,S_2<1,S_3\ge 1, \\
\cdots\\
\end{array}\right.
\end{eqnarray*}
Thus the expectation of $\xi$ is
\begin{eqnarray*}
E(\xi) &=& E(S_1 \mid S_1<1, S_2\ge 1)P( S_1<1, S_2\ge 1)\\
        && + E(S_1+S_2 \mid S_1<1, S_2<1,S_3\ge 1)P(S_1<1,S_2<1,S_3\ge 1)\\
        &&+\cdots\\
       &=& abc+2ab^2c+3ab^3c+\cdots=\frac{abc}{(1-b)^2}=e^{\lambda}-1-\lambda.
\end{eqnarray*}
For simplicity, we have used the following shortcut, 
\begin{eqnarray*}
a &=& E(S_1\mid S_1<1) = \frac{1-e^{-\lambda}-\lambda e^{-\lambda}}{1- e^{-\lambda}}, \\
b &=& P(S_1<1) = 1 - e^{-\lambda}, \\
c &=& P(S_1\ge 1) = e^{-\lambda}.
\end{eqnarray*}

\underline{Note:} If $\xi$ is a random variable with pdf given by $f(x)$, then the conditional expectation
\begin{eqnarray*}
E(\xi| a\le \xi \le b)=\frac{\int_a^b xf(x)dx}{\int_a^b f(x)dx}.
\end{eqnarray*}

Another method is to observe that the process repeats itself after the first car passes the woman. 
Thus we can write the following equation, 
\begin{eqnarray*}
E(\xi) = P(S_1<1)[E(S_1\mid S_1<1) + E(\xi)].
\end{eqnarray*}

}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{enumerate}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}




